The present invention relates to software analysis and, more particularly, to a method of determining execution state of a single or multiple processors at any given time.
When designing a computer-based system, a determination is made about whether the system has enough computational resources such as processor speed, static or volatile memory, and peripherals to run the intended application. Conversely, system designers face an uphill task to figure out whether the given application is optimally using system resources or it needs some tweaking for optimal resource utilization. The software analysis tools that help answer these questions are called profilers. A profiler reports information such as how much time the processor is spending in a function, how often each function is called, which functions the processor calls through before running a given function, how long different threads of execution run on a processor, what is the pattern of processor or memory usage over time. For a multi-processor system, a profiler reports above information potentially for each processor in the system. This information forms the basis for reporting and analyzing information about higher level application or operating system constructs such as heap memory, execution threads, semaphores, queues, events etc.
A profiler gathers information about a given system by various methods such as source or object code instrumentation, runtime system patching and runtime invasive system analysis. Source code instrumentation method modifies the application source code with certain “hooks” to facilitate information collection when application runs. Source code instrumentation method therefore needs application source code and recompilation of source to be effective. On the other hand, object code instrumentation method works by “patching” the application object code with the “information collection hooks” and therefore needs re-linking of object code. Advantages of object code instrumentation are that it doesn't need application source and therefore allows analysis of third party object code also.
A runtime system patching method works by modifying the running system object code in memory with “information collection hooks”. A big advantage of this method is that user doesn't need to re-compile or re-link application code to perform analysis and user can monitor a live system possibly deployed in the field.
Another method of analyzing a system involves periodically “snooping” into the system to figure out what the system was doing when the system snooped into. This periodic snooping gives statistical information about the system such as performance bottlenecks in the system, major thread behavior on all processors in the system, where each processor is “most often” spending time etc.